<?php

namespace App\Models\Task\Assignment;

use App\Models\Community\Gift;
use App\Models\School\Classes;
use App\Models\School\Student;
use App\Models\School\Subject;
use App\Models\Sys\Child;
use App\Models\User\User;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Support\Facades\DB;

class Confirm extends Model
{
    protected $table = 'jxt_task_assignment_confirm';
    public $primaryKey = 'id';

    const CREATED_AT = null;
    const UPDATED_AT = null;

    public function user()
    {
        return $this->belongsTo(User::class,'user_id','id')
            ->select(['id','username','avatar','telephone']);
    }


    public function child()
    {
        return $this->belongsTo(Child::Class,'child_id','child_id')->where('status',1);
    }

    public function student()
    {
        return $this->belongsToMany(Student::class, 'jxt_school_child_student','child_id','student_id','child_id');
    }



}
